#define CSOCIAL_RESPONSE_HEADER "cbox"
#define SECOND_ON_DAY	86400
#define SECOND_ON_WEEK	604800

///BEGIN PHP PLATFORM ==========
#if defined(PLATFORM_PHP)
#define RTVOID
#define RTBINARY
#define RTBOOL
#define RTINT
#define RTBUFFER
#define RTOBJ
#define RTSTR

#define SIZE_OF_INT8	1
#define SIZE_OF_INT16	2
#define SIZE_OF_INT32	4

//macro to work with byte buffer
#define BUFALLOCATE(size) ByteBuffer::allocate(size)
#define BUFARRAY(buffer) buffer->_array()
#define BUFSWAP(bytes) ByteBuffer::wrap(bytes)

#define RINT8(buffer) DataUtil::readInt8(buffer)
#define RINT16(buffer) DataUtil::readInt16(buffer)
#define RINT32(buffer) DataUtil::readInt32(buffer)
#define RBIN(buffer,len) DataUtil::readBytes(buffer,len)
#define RBBIN(buffer) DataUtil::readBBin(buffer)
#define RSBIN(buffer) DataUtil::readSBin(buffer)

#define PUTINT8(buffer,i8) DataUtil::writeInt8(buffer,i8)
#define PUTINT16(buffer,i16) DataUtil::writeInt16(buffer,i16)
#define PUTINT32(buffer,i32) DataUtil::writeInt32(buffer,i32)
#define PUTBIN(buffer,bin)	DataUtil::writeBytes(buffer,bin)
#define PUTBBIN(buffer,bin) DataUtil::writeBBin(buffer,bin)
#define PUTSBIN(buffer,bin) DataUtil::writeSBin(buffer,bin)

//macro to convert string to byte array and byte arrays to string
#define STRTOBYTES(str) unpack('C*',str)
#define BYTESTOSTR(bytes) implode(array_map("chr", bytes))

//status of id of user
#define ID_STATUS_NEWCREATE		0
#define ID_STATUS_USER			1
#define ID_STATUS_GUEST			2
#define ID_STATUS_UNUSE			3

//macro ultility
#define MSECOND microtime
#define SECOND() time()
#define SHA256(msg) UtilHash::sha256(msg)
#define GENKEY(length) UtilHash::generateKey(length)

//working with session
#define ACCOUNT_TYPE_NONE		0
#define ACCOUNT_TYPE_ACCOUNT	1
#define ACCOUNT_TYPE_GUEST		2
#define SESSION(a) $_SESSION[a]
#define SESSION_START() session_start()
#define SESSION_ID session_id
#define SESSION_NEW_ID session_regenerate_id
#define SESSION_SELF self::$Session

//license level
#define LICENSE_NONE	(-1)
#define LICENSE_VIEW	(0)
#define LICENSE_VIEWS	(1)
#define LICENSE_ADD		(2)
#define LICENSE_ADDS	(3)
#define LICENSE_EDIT	(4)
#define LICENSE_EDITS	(5)
#define LICENSE_MANAGE	(6)
#define LICENSE_MANAGES	(7)
#define LICENSE_ALL		(9)
#define LICENSE(name,level)	(Session::getRoleOfArea(name) >= level)

//macro 
#define BITON(src,add) {src|=add;}
#define BITOFF(src,mark) {src = ((src ^ mark) & src);}
#define ISBIT(src,mark) ((src & mark) > 0)

//certificate macro
#define CERTIFICATE_STR(uniqueid,user_secret,cer_handle,time_expire) (uniqueid . user_secret . cer_handle . ((SECOND() - (SECOND()%time_expire))/time_expire))
//time exprie
#define CER_LOGIN_EXPIRE	(30*SECOND_ON_DAY)
#endif //PLATFORM_PHP
///END PHP PLATFORM ==========

#include "SocialDefine_DatabaseServer.h"
#include "SocialDefine_Key.h"
#include "SocialDefine_Config.h"
#include "SocialDefine_Error_Code.h"
#include "SocialDefine_Interface.h" 
#include "SocialDefine_Setting.h"
#include "SocialDefine_CSocial_Command.h"
#include "SocialDefine_Game_Center.h"